import {createAction} from 'redux-actions';
import {
  POST_SMS_SEND_CODE,
} from './../constants/actionTypes'
import * as smsApi from './../apis/sms'

export const sendCode = createAction(POST_SMS_SEND_CODE, async(body)=>{
  return await smsApi.postSendCode(body)
    .then((data) =>{
      if (data){
        return data
      }
      throw 'smsSendCodeError'
    })
}, (body)=>{
  return {
    ...body,
    sync: 'smsSendCode'
  }
})